package edu.sysu.cshare.gui;

import javax.swing.JPanel;

import edu.sysu.cshare.control.HomeworkManager;
import edu.sysu.cshare.util.gui.GUI;

import javax.swing.JSplitPane;
import java.awt.BorderLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;

public class Pnl_Homework_Mgt extends JPanel {
	private HomeworkManager homeworkManager = null;

	/**
	 * Create the panel.
	 */
	public Pnl_Homework_Mgt(HomeworkManager hm) {
		this.homeworkManager=hm;
		setLayout(new BorderLayout(0, 0));
		
		JPanel panel = new JPanel();
		add(panel, BorderLayout.NORTH);
		
		JPanel panel_1 = new JPanel();
		add(panel_1, BorderLayout.CENTER);
		GridBagLayout gbl_panel_1 = new GridBagLayout();
		gbl_panel_1.columnWidths = new int[]{172, 105, 0};
		gbl_panel_1.rowHeights = new int[]{23, 0, 0, 0, 0, 0};
		gbl_panel_1.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
		gbl_panel_1.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		panel_1.setLayout(gbl_panel_1);
		
		JButton btnNewButton = new JButton("新建作业项目");
		GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
		gbc_btnNewButton.anchor = GridBagConstraints.SOUTHWEST;
		gbc_btnNewButton.gridx = 1;
		gbc_btnNewButton.gridy = 4;
		panel_1.add(btnNewButton, gbc_btnNewButton);
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				GUI.showModalDialog(new Dlg_HomeworkDetail(null, Pnl_Homework_Mgt.this.homeworkManager));
				((Pnl_Homework)Pnl_Homework_Mgt.this.getParent().getParent()).updateHomework();
			}
		});

	}
}
